package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Courses3;
import com.ruoyi.system.service.ICourses3Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 课程表3Controller
 * 
 * @author ruoyi
 * @date 2025-02-14
 */
@RestController
@RequestMapping("/system/courses_3")
public class Courses3Controller extends BaseController
{
    @Autowired
    private ICourses3Service courses3Service;

    /**
     * 查询课程表3列表
     */
    @PreAuthorize("@ss.hasPermi('system:courses_3:list')")
    @GetMapping("/list")
    public TableDataInfo list(Courses3 courses3)
    {
        startPage();
        List<Courses3> list = courses3Service.selectCourses3List(courses3);
        return getDataTable(list);
    }

    /**
     * 导出课程表3列表
     */
    @PreAuthorize("@ss.hasPermi('system:courses_3:export')")
    @Log(title = "课程表3", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Courses3 courses3)
    {
        List<Courses3> list = courses3Service.selectCourses3List(courses3);
        ExcelUtil<Courses3> util = new ExcelUtil<Courses3>(Courses3.class);
        util.exportExcel(response, list, "课程表3数据");
    }

    /**
     * 获取课程表3详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:courses_3:query')")
    @GetMapping(value = "/{courseId}")
    public AjaxResult getInfo(@PathVariable("courseId") Integer courseId)
    {
        return success(courses3Service.selectCourses3ByCourseId(courseId));
    }

    /**
     * 新增课程表3
     */
    @PreAuthorize("@ss.hasPermi('system:courses_3:add')")
    @Log(title = "课程表3", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Courses3 courses3)
    {
        return toAjax(courses3Service.insertCourses3(courses3));
    }

    /**
     * 修改课程表3
     */
    @PreAuthorize("@ss.hasPermi('system:courses_3:edit')")
    @Log(title = "课程表3", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Courses3 courses3)
    {
        return toAjax(courses3Service.updateCourses3(courses3));
    }

    /**
     * 删除课程表3
     */
    @PreAuthorize("@ss.hasPermi('system:courses_3:remove')")
    @Log(title = "课程表3", businessType = BusinessType.DELETE)
	@DeleteMapping("/{courseIds}")
    public AjaxResult remove(@PathVariable Integer[] courseIds)
    {
        return toAjax(courses3Service.deleteCourses3ByCourseIds(courseIds));
    }
}
